<?php


namespace xzdream;


class money
{
    /**
     * 判断有效的小数位
     * @param string $money
     * @param int $validLen
     * @return bool
     */
    public static function validDecimals(string $money,int $validLen=3):bool {
        $count = 0;
        $temp = explode ( '.', $money );
        if (sizeof ( $temp ) > 1) {
            $decimal = end ( $temp );
            $count = strlen ( $decimal );
        }
        if($count <= $validLen){
            return true;
        }
        return false;
    }
}